package com.atguigu.springbootcrud.biz;

import com.atguigu.springbootcrud.Dao.crudMapper;
import com.atguigu.springbootcrud.Dao.crudMapper_emp;
import com.atguigu.springbootcrud.pojo.dept;
import com.atguigu.springbootcrud.pojo.emp;
import com.atguigu.springbootcrud.vo.tjQuery;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lhl
 * @create 2019-12-27 22:50
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, isolation = Isolation.READ_COMMITTED, readOnly = true)
public class crudBiz {
    @Resource
    private crudMapper crudMapper;
    @Resource
    private crudMapper_emp crudMapper_emp;

    public int SaveEmp(emp emp){
        return crudMapper_emp.insert(emp);
    }
    public int RemoveEmp(int emp_id){
        return crudMapper_emp.deleteById(emp_id);
    }
    public int modifyEmp(emp empp){
        return crudMapper_emp.updateById(empp);
    }
    public List<tjQuery> findAll(){
        return crudMapper_emp.findAll();
    }
    public List<dept> findDeptAll(){
        return crudMapper.selectList(null);
    }
}
